<template>
  <div>
  <div>我的总资产{{ money }}元</div>
  是不是有钱人:<input type="checkbox" :checked="flag" />
  <div style="display: none">
  {{ (flag = money  > 10000 ? true : false)}}
 
</div>
  <div>目前的状态:{{ money > 10000 ? '有钱人' : '穷光蛋' }}</div>
  <div>
    消费项目:
      <button @click="a">奶茶50</button>
      <button @click="b">吃饭100</button>
      <button @click="c">约会1000</button>  
      <button @click="d">送外卖+100</button>
  </div>
  </div>
</template>
<script>
export default {
  name: 'new',
  data() {
    return {
      money: 10000,
      flag: true,
    }
  },
  methods: {
    a() {
      this. money -= 50
      this.fn ()
    },
    b() {
      this.money -= 100
      this.fn ()
    },
    c() {
      this.money -= 1000
      this.fn ()
    },
    d() {
      this.money += 100
      this.fn ()
    },
    fn() {
      this.flag = this.money > 10000 ? true : false
  }
  }
}
</script>